2. Add Beehiiv newsletter subscribers from Gumroad sales
工作流概述
这是一个包含10个节点的复杂工作流,主要用于自动化处理各种任务。
工作流源代码
{
"id": "W1xEzKKEd1qV2D7V",
"meta": {
"instanceId": "dfec462482c1b16c8ef1928d51584c7f0ae64b3bfaa72e08675b15754b903bd2",
"templateCredsSetupCompleted": true
},
"name": "2. Add Beehiiv newsletter subscribers from Gumroad sales",
"tags": [
{
"id": "IQNCfEb2qHXxw7NO",
"name": "template",
"createdAt": "2025-04-26T14:50:39.694Z",
"updatedAt": "2025-04-26T14:50:39.694Z"
},
{
"id": "K4VMFA2Vwk2LRKCu",
"name": "1node",
"createdAt": "2025-04-26T11:57:21.772Z",
"updatedAt": "2025-04-26T11:57:21.772Z"
},
{
"id": "mAtRn7JRKGsmOL3v",
"name": "gumroad",
"createdAt": "2025-04-26T11:57:16.167Z",
"updatedAt": "2025-04-26T11:57:16.167Z"
}
],
"nodes": [
{
"id": "18e8530e-d04f-47d4-b406-b2961d45f1c1",
"name": "Gumroad Sale Trigger",
"type": "n8n-nodes-base.gumroadTrigger",
"position": [
-380,
-280
],
"webhookId": "98ba7c08-2193-4ddf-9249-af7899716925",
"parameters": {
"resource": "sale"
},
"credentials": {
"gumroadApi": {
"id": "wgjGSvLjsRBJImsQ",
"name": "Gumroad account"
}
},
"typeVersion": 1
},
{
"id": "6e464a73-a5c0-4a5d-95ce-c3cc2547a373",
"name": "append row in CRM",
"type": "n8n-nodes-base.googleSheets",
"position": [
300,
-280
],
"parameters": {
"columns": {
"value": {
"date": "={{ $('Gumroad Sale Trigger').item.json.sale_timestamp }}",
"email": "={{ $('Gumroad Sale Trigger').item.json.email }}",
"country": "={{ $('Gumroad Sale Trigger').item.json.ip_country }}",
"product name": "={{ $('Gumroad Sale Trigger').item.json.product_name }}"
},
"schema": [
{
"id": "date",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "date",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "product name",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "product name",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "email",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "email",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "country",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "country",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1XYMstoZ4j3O5T-UYz21ky7P5bkUtzYXQGYCQTRVWCI4/edit#gid=0",
"cachedResultName": "Sheet1"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1XYMstoZ4j3O5T-UYz21ky7P5bkUtzYXQGYCQTRVWCI4",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1XYMstoZ4j3O5T-UYz21ky7P5bkUtzYXQGYCQTRVWCI4/edit?usp=drivesdk",
"cachedResultName": "Gumroad sales CRM"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "Ou2SgvNZctBeYWT5",
"name": "Google Sheets account"
}
},
"typeVersion": 4.5
},
{
"id": "1f1b0840-0da9-4118-96d5-62a1a36f902b",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-560,
-580
],
"parameters": {
"width": 320,
"height": 460,
"content": "## Trigger on a new Gumroad sale
### Requirements
- A [Gumroad]() account
- A product listed. We used ours [here](https://1node.gumroad.com/l/topaitools)
- Head to Settings > Advanced, and create a new application
### Set up
- Paste your access token on this Gumroad sale trigger"
},
"typeVersion": 1
},
{
"id": "35f93009-1960-4cde-bfa6-dc7dfed5e194",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-220,
-500
],
"parameters": {
"color": 4,
"width": 400,
"height": 380,
"content": "## Connection to [Beehiiv](https://www.beehiiv.com?via=1node-ai) newsletter
### Requirements
- A [Beehiiv](https://www.beehiiv.com?via=1node-ai) account
- A publication created
- Generate a new API"
},
"typeVersion": 1
},
{
"id": "bbfcab7c-92fa-4a23-abc2-480c286905ac",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
200,
-540
],
"parameters": {
"color": 4,
"width": 320,
"height": 420,
"content": "## Load into CRM
### Requirements
- Set up your api and credentials for Google Sheets. You can find the n8n docs [here](https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.googlesheets/?utm_source=n8n_app&utm_medium=node_settings_modal-credential_link&utm_campaign=n8n-nodes-base.googleSheets)
- Append the row to your table with your desired data collected previously"
},
"typeVersion": 1
},
{
"id": "46a7cfcf-a042-4fe3-9f76-62eb46ecbbd0",
"name": "List publications",
"type": "n8n-nodes-base.httpRequest",
"position": [
-160,
-280
],
"parameters": {
"url": "https://api.beehiiv.com/v2/publications",
"options": {},
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth"
},
"credentials": {
"httpBearerAuth": {
"id": "ZcZlbMhodQQpmBk3",
"name": "Bearer Beehiiv"
},
"httpHeaderAuth": {
"id": "Qvu08SMoEOK2V2xB",
"name": "Beehiiv newsletter"
}
},
"typeVersion": 4.2
},
{
"id": "ab7bede8-0019-4cb4-ad16-b9ccbbe8b15a",
"name": "Post subscription",
"type": "n8n-nodes-base.httpRequest",
"position": [
20,
-280
],
"parameters": {
"url": "=https://api.beehiiv.com/v2/publications/{{ $json.data[0].id }}/subscriptions",
"method": "POST",
"options": {},
"sendBody": true,
"authentication": "genericCredentialType",
"bodyParameters": {
"parameters": [
{
"name": "email",
"value": "={{ $('Gumroad Sale Trigger').item.json.email }}"
}
]
},
"genericAuthType": "httpHeaderAuth"
},
"credentials": {
"httpHeaderAuth": {
"id": "Qvu08SMoEOK2V2xB",
"name": "Beehiiv newsletter"
}
},
"typeVersion": 4.2
},
{
"id": "cafb7301-06fe-49f9-a033-434459b181e5",
"name": "Notify in channel",
"type": "n8n-nodes-base.telegram",
"position": [
760,
-280
],
"webhookId": "16dedd5e-7f93-45fb-8add-2928a53f125f",
"parameters": {
"text": "=🔔 New Gumroad sale!
Product: {{ $('Gumroad Sale Trigger').item.json.product_name }}
Email: {{ $('Gumroad Sale Trigger').item.json.email }}
Country: {{ $('Gumroad Sale Trigger').item.json.ip_country }}",
"chatId": "={{ $json.telegramChatId }}",
"additionalFields": {
"appendAttribution": false
}
},
"credentials": {
"telegramApi": {
"id": "TbJJ7DHhEE1GwKQQ",
"name": "Telegram account"
}
},
"typeVersion": 1.2
},
{
"id": "912c8a8f-074e-486f-b337-b828ae19b6af",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
540,
-440
],
"parameters": {
"width": 360,
"height": 320,
"content": "## Notify team in Telegram
Set up your Telegram bot and add to a channel as admin to notify everyone about the updates."
},
"typeVersion": 1
},
{
"id": "5613a93b-f5ae-4478-86a8-4ea87ac5b9bd",
"name": "Set ChatID",
"type": "n8n-nodes-base.set",
"position": [
580,
-280
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "089c1b05-3ac3-419e-a25e-e98d0b7fa49c",
"name": "telegramChatId",
"type": "string",
"value": "<your chat id>"
}
]
}
},
"typeVersion": 3.4
}
],
"active": true,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "34946f82-9af3-4e1b-bf98-67fb4c55a26c",
"connections": {
"Set ChatID": {
"main": [
[
{
"node": "Notify in channel",
"type": "main",
"index": 0
}
]
]
},
"List publications": {
"main": [
[
{
"node": "Post subscription",
"type": "main",
"index": 0
}
]
]
},
"Post subscription": {
"main": [
[
{
"node": "append row in CRM",
"type": "main",
"index": 0
}
]
]
},
"append row in CRM": {
"main": [
[
{
"node": "Set ChatID",
"type": "main",
"index": 0
}
]
]
},
"Gumroad Sale Trigger": {
"main": [
[
{
"node": "List publications",
"type": "main",
"index": 0
}
]
]
}
}
}
功能特点
- 自动检测新邮件
- AI智能内容分析
- 自定义分类规则
- 批量处理能力
- 详细的处理日志
技术分析
节点类型及作用
- Gumroadtrigger
- Googlesheets
- Stickynote
- Httprequest
- Telegram
复杂度评估
配置难度:
维护难度:
扩展性:
实施指南
前置条件
- 有效的Gmail账户
- n8n平台访问权限
- Google API凭证
- AI分类服务订阅
配置步骤
- 在n8n中导入工作流JSON文件
- 配置Gmail节点的认证信息
- 设置AI分类器的API密钥
- 自定义分类规则和标签映射
- 测试工作流执行
- 配置定时触发器(可选)
关键参数
| 参数名称 | 默认值 | 说明 |
|---|---|---|
| maxEmails | 50 | 单次处理的最大邮件数量 |
| confidenceThreshold | 0.8 | 分类置信度阈值 |
| autoLabel | true | 是否自动添加标签 |
最佳实践
优化建议
- 定期更新AI分类模型以提高准确性
- 根据邮件量调整处理批次大小
- 设置合理的分类置信度阈值
- 定期清理过期的分类规则
安全注意事项
- 妥善保管API密钥和认证信息
- 限制工作流的访问权限
- 定期审查处理日志
- 启用双因素认证保护Gmail账户
性能优化
- 使用增量处理减少重复工作
- 缓存频繁访问的数据
- 并行处理多个邮件分类任务
- 监控系统资源使用情况
故障排除
常见问题
邮件未被正确分类
检查AI分类器的置信度阈值设置,适当降低阈值或更新训练数据。
Gmail认证失败
确认Google API凭证有效且具有正确的权限范围,重新进行OAuth授权。
调试技巧
- 启用详细日志记录查看每个步骤的执行情况
- 使用测试邮件验证分类逻辑
- 检查网络连接和API服务状态
- 逐步执行工作流定位问题节点
错误处理
工作流包含以下错误处理机制:
- 网络超时自动重试(最多3次)
- API错误记录和告警
- 处理失败邮件的隔离机制
- 异常情况下的回滚操作